﻿using System.Collections.Generic;
using System.Linq;

namespace Wlx.LogAnalysis.Application.Models
{
    public class ImportFileModel
    {
        public string Name { get; set; }
        public string Path { get; set; }
        public Dictionary<string, RangeModel> KeyValueDic { get; set; } = new Dictionary<string, RangeModel>();
        public FileExtension FileExtension
        {
            get
            {
                var extension = Name?.Split('.').LastOrDefault() ?? string.Empty;
                switch (extension.ToLowerInvariant())
                {
                    case "rpt":
                    case "dut":
                        return FileExtension.Rpt;
                    default:
                        return FileExtension.Others; 
                }
            }
        }

        public ImportFileModel() { }
        public ImportFileModel(string name, string path)
        {
            Name = name;
            Path = path;
        }
    }


    public enum FileExtension
    {
        Rpt = 1,
        Others = 2
    }
}
